/*
 * nipcManager.c
 *
 *  Created on: 24/09/2011
 *      Author: utn_so
 */
#include "nipcManager.h"


char *serializarNipc(uint8_t type, char* message,int32_t payloadLength)
{
	PAQUETE_NIPC_CABECERA newMessage;
	newMessage.type = type;
	newMessage.payloadlength = payloadLength;


	char *buffer =malloc(sizeof(PAQUETE_NIPC_CABECERA) + payloadLength);
	memcpy(buffer, &newMessage,sizeof(PAQUETE_NIPC_CABECERA));

	char payload[payloadLength];
	memcpy(payload,message,payloadLength);


	memcpy(buffer+sizeof(PAQUETE_NIPC_CABECERA), payload, payloadLength);

	return buffer;

}


